//
//  LLDefaultView.m
//  Weibo
//
//  Created by 李灵斌 on 15-2-1.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "LLDefaultView.h"

@interface LLDefaultView ()

- (IBAction)regesterBtnClick:(id)sender;
- (IBAction)loginBtnClick:(id)sender;
@property (nonatomic, strong) CADisplayLink *link;
@end

@implementation LLDefaultView

+ (instancetype)defaultView{
    
    return [[[NSBundle mainBundle] loadNibNamed:@"LLDefaultController" owner:nil options:nil] lastObject];
}

#pragma mark - 外部方法
- (void)startRotate{
    
    self.link = [CADisplayLink displayLinkWithTarget:self selector:@selector(rotating)];
    [self.link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
    
}

- (void)rotating{
    
    self.animatePic.transform = CGAffineTransformRotate(self.animatePic.transform, M_PI_2 / 100);
}

- (void)endRotate{
    
    [self.link invalidate];
    self.link = nil;
}

- (IBAction)regesterBtnClick:(id)sender {
    
}

- (IBAction)loginBtnClick:(id)sender {
    
    // 按钮点击跳转控制器，只能通过控制器来跳转。这里并不能拿到控制器只能通过代理
    if ([self.delegate respondsToSelector:@selector(defaultView:loginBtn:)]) {
        
        [self.delegate defaultView:self loginBtn:sender];
    }

}
@end
